home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / More Source / C⁄C++ / Xconq 7.0d37 / source / kernel / vms.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-01  |  1.3 KB  |  39 lines  |  [TEXT/KAHL]

  1. /* VMS Stuff
  2.    Copyright (C) 1992, 1993, 1994 Stanley T. Shebs.
  3.  
  4. Xconq is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2, or (at your option)
  7. any later version.  See the file COPYING.  */
  8.  
  9. /* fd_set for select.  */
  10.  
  11. /* Number of descriptors that can fit in an `fd_set'.  */
  12. #define    __FD_SETSIZE    256
  13.  
  14. /* It's easier to assume 8-bit bytes than to get CHAR_BIT.  */
  15. #define    __NFDBITS    (sizeof(unsigned long int) * 8)
  16. #define    __FDELT(d)    ((d) / __NFDBITS)
  17. #define    __FDMASK(d)    (1 << ((d) % __NFDBITS))
  18.  
  19. #define    __ptr_t        char *
  20.  
  21. typedef struct
  22. {
  23.   unsigned long int __bits[(__FD_SETSIZE + (__NFDBITS - 1)) / __NFDBITS];
  24. } __fd_set;
  25.  
  26. /* This line MUST be split!  Otherwise m4 will not change it.  */
  27. #define    __FD_ZERO(set)    \
  28.   ((void) memset((__ptr_t) (set), 0, sizeof(fd_set)))
  29. #define    __FD_SET(d, set)    ((set)->__bits[__FDELT(d)] |= __FDMASK(d))
  30. #define    __FD_CLR(d, set)    ((set)->__bits[__FDELT(d)] &= ~__FDMASK(d))
  31. #define    __FD_ISSET(d, set)    ((set)->__bits[__FDELT(d)] & __FDMASK(d))
  32.  
  33. #define    FD_SETSIZE    __FD_SETSIZE
  34. #define    fd_set        __fd_set
  35. #define    FD_ZERO(set)    __FD_ZERO(set)
  36. #define    FD_SET(d, set)    __FD_SET((d), (set))
  37. #define    FD_CLR(d, set)    __FD_CLR((d), (set))
  38. #define    FD_ISSET(d, set)__FD_ISSET((d), (set))
  39.